Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/context based reducer #31

Merged
merged 35 commits into from
May 3, 2021
Merged

Conversation

langdal
Copy link
Member

@langdal langdal commented Apr 28, 2021

Encapsulate experiment state in a context object controlled by ExperimentProvider.

This PR also contain some refactorings that we should use as input for discussion.

  1. Tests are moved so they live along side the file that is to be tested (only exception is index.tsx because of limitations in Next.JS)
  2. Simplify action types. TS still allows for auto completion of types. For examples, see experiment.tsx. The goal is less boilerplate code
  3. Change action names to be present tense because they should be seen as commands, not events. (actions can fail, events cannot as they already happened)
  4. Server side rendering is disabled to overcome annoying styling errors related to material UI

@langdal langdal self-assigned this Apr 28, 2021
@langdal langdal linked an issue Apr 28, 2021 that may be closed by this pull request
@langdal langdal marked this pull request as ready for review May 2, 2021 16:45
@langdal langdal requested a review from j-or May 2, 2021 16:45
expect(() => render(<ExperimentTester />)).toThrow("useExperiment must be used within an ExperimentProvider")
})

it("fails if called outside provider", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this the success scenario?

@langdal langdal merged commit d6cbe4f into main May 3, 2021
@langdal langdal deleted the feature/context_based_reducer branch May 3, 2021 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Store JSON in local storage
2 participants